//
// Created by webturing on 2024/1/1.
//
#include <bits/stdc++.h>

using namespace std;

int main() {
    map<char, int> p;
    p['('] = 1;
    p['+'] = 2;
    p['-'] = 2;
    p['*'] = 3;
    p['/'] = 3;
    p[')'] = 4;
    string s;
    // ifstream cin("input.txt");
    while (cin >> s) {

        //中缀转后缀
        vector<int> result;
        stack<char> op;
        int t = 0;
        for (int i = 0; i < s.size() - 1; i++) {
            if (isdigit(s[i])) {
                t = t * 10 + s[i] - '0';
                if (!isdigit(s[i + 1])) {
                    result.push_back(t);
                    t = 0;
                }
            } else {
                if (s[i] == '+' || s[i] == '-' || s[i] == '*' || s[i] == '/') {
                    if (op.size() <= 0) {
                        op.push(s[i]);
                    } else {
                        while (op.size() > 0 && p[op.top()] >= p[s[i]]) {
                            result.push_back((int) op.top());
                            op.pop();
                        }
                        op.push(s[i]);
                    }
                } else if (s[i] == '(') {
                    op.push(s[i]);
                } else {
                    while (op.top() != '(') {
                        result.push_back((int) op.top());
                        op.pop();
                    }
                    op.pop();
                }
            }
        }
        while (op.size() > 0) {
            result.push_back((int) op.top());
            op.pop();
        }
//        for(auto i : result){
//            if(i>=40)cerr<<(char)i<<" ";
//            else
//            cerr << i << " ";
//        }
        //计算后缀式
        stack<int> sk;
        for (int i = 0; i < result.size(); i++) {
            if (result[i] == '+' || result[i] == '-' || result[i] == '*' || result[i] == '/') {
                int b = sk.top();
                sk.pop();
                int a = sk.top();
                sk.pop();
                int c;
                if (result[i] == '+') {
                    c = a + b;
                } else if (result[i] == '-') {
                    c = a - b;
                } else if (result[i] == '*') {
                    c = a * b;
                } else {
                    c = a / b;
                }
                sk.push(c);
            } else {
                sk.push(result[i]);
            }
        }
        cout << sk.top() << endl;
    }
}
